home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOpus Plus
/
DOpus Plus.iso
/
Tutorial
/
C Guide
/
Simple_Module2
/
ExampleRequest.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-08-22
|
2KB
|
70 lines
/*******************************************************************
ExampleRequest.c
Some Notes:
I write my defines all in uppercase.
All defines starting with "MSG_" are from the buildin.cd.
*********************************************************************/
#include "includes/ExampleRequest.h"
void ExampleRequest( STRPTR args, struct Screen *screen, IPCData *ipc )
{
ERData *erd;
// allocate some memory from our globally pool
if( (erd = AllocMemH(mempool, sizeof(ERData))) )
{
if( *args )
{
erd->ptr_read = args;
// going to the end of the args
while( *erd->ptr_read++ );
// it does point at least at the "\0" of the string,
// Jonathan does also append a some other stuff, we
// want this not at this stage :-)
erd->ptr_read -= 3;
// Now we can make a reversed copy
erd->ptr_write = erd->buffer;
while( ((ULONG) erd->ptr_read) >= ((ULONG) args) )
{
*erd->ptr_write++ = *erd->ptr_read--;
erd->count++;
}
// since we have used our memorypool with the flag
// MEMF_CLEAR and we have not used it before, we must
// not append a "\0" to erd->buffer
}
sprintf( erd->output, "%s : %s%s : %s\n%s : %ld",
DOpusGetString( locale, MSG_ARGUMENTS ), args,
DOpusGetString( locale, MSG_REVERSED ), erd->buffer,
DOpusGetString( locale, MSG_COUNTED ), erd->count );
// now we are ready to open our requester
// we do not check here the result, but should be at least
// no problem for you...
AsyncRequestTags( ipc, REQTYPE_SIMPLE, NULL, NULL, NULL,
AR_Screen, screen,
AR_Title, DOpusGetString(locale, MSG_ER_TITLE),
AR_Message, erd->output,
AR_Button, DOpusGetString(locale, MSG_OKAY_BUTTON),
TAG_DONE );
// free our memory
FreeMemH( erd );
}
}